{/** 
$list=(new \extension\widget\widget\ListWidget)->toArray();
optional:$entire_actions=[(new \extension\widget\entity\Action)->toArray()];
         $multi_actions=[(new \extension\widget\entity\Action)->toArray()];
flag:selectable 可以选择多项数据一起操作，可以执行的操作由$multi_actions定义
        sortable   可以进行排序操作
 */}

{if !defined('COMMON')}{include file="widget@base/common" /}{/if}

{if isset($entire_actions)}
<p>
    <span>对所有项目执行:</span>
    {foreach $entire_actions as $key=>$action}
    <button type="button" data-action="{$action.href}" data-confirm="{$action.confirm}" onclick="submit_entire(this)" title="{$action.describe}">{$action.title}</button>
    {/foreach}
</p>
{/if}
<form id="table_form">
<table>
    <thead>
        <tr>
            {if isset($list.selectable)}<th>选择</th>{/if}
            {foreach $list.fields as $key=>$field}
            <th>{$field.title}</th>
            {/foreach}
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {foreach $list.data as $index=>$item}
        <tr>
            {if isset($list.selectable)}<td><input type="checkbox" name="select[]" id="" value="{$item[$list.primary]}"></td>{/if}
            {foreach $list.fields as $key=>$field}
            <td>{$item[$field.code]}</td>
            {/foreach}
            <td>
                {foreach $item.actions as $key=>$action}
                <button type="button" data-action="{$action.href}" data-confirm="{$action.confirm}" onclick="submit_item(this)" title="{$action.describe}">{$action.title}</button>
                {/foreach}
            </td>
        </tr>
        {/foreach}
    </tbody>
</table>
{if isset($multi_actions)}
<p>
    <span>对选中项目执行:</span>
    {foreach $multi_actions as $key=>$action}
    <button type="button" data-action="{$action.href}" data-confirm="{$action.confirm}" onclick="submit_multi(this)" title="{$action.describe}">{$action.title}</button>
    {/foreach}
</p>
{/if}
</form>
{$list.page|default=''}
